<!DOCTYPE html>

<html lang="zh-cn">

{include file="public/head" /}

<link href="/static/member/global-min.css" type="text/css" rel="stylesheet">
<link href="__CSS__/member.css" type="text/css" rel="stylesheet">
<link href="/static/home/layui/css/layui.css" type="text/css" rel="stylesheet">
<style>

    .bonus{display: block;}

    .phoneInfoCheck .getVerify-Invalid { background: #7a7c7d; cursor: default }

    .disabled{pointer-events:none;}

</style>

<!--头部-->

{include file="public/header" /}

<body>
<br>
<br>
<br>
<!-- 左侧导航区域（可配合layui已有的垂直导航） -->
<div class="wraper_base">
    <div class="wraper_content">
        <div class="acont_menu">
            <dl>
                <dt><h2>会员中心</h2></dt>
                <dd>
                    <ul class="item list">
                        <li class="{if $action eq 'index'}current{/if}"><a href="{:url('member/index')}">基本信息</a></li>
                        <li ><a href="#">我的积分</a></li>
                        <li ><a href="#">我的评论</a></li>
                        <li ><a href="#">用户充值</a></li>
                        <li ><a href="#">账号安全</a></li>
                    </ul>
                </dd>
            </dl>
        </div>
        <div class="member_info fr">
            <img src="/static/home/img/member_bg.png" style="width: 100%">
            <div class="member_msg" >
                <div class="member_div">
                    <img src="/static/home/img/head.png" style="width: 80px">
                </div>
                <div class="member_div">
                   <div class="member_nickname">{$nickname}</div>
                   <div class="member_nickname">欢迎回来大观网！</div>
                </div>
                <div class="member_div" style="width: 400px;float: right">
                    <div class="member_font">上一次登录时间：{$user.update_time}</div>
                    <div class="member_font">生日：{$user.brithday}</div>
                </div>
            </div>
            <div class="modBox">
                <div class="cpt cpt_section">
                    <h2>个人资料</h2>
                </div>
                <div class="formsub formsubB inner" >
                    <ul id="tabfirst">
                        <li class="tabin">基本信息</li>
                    </ul>
                    <div class="clear"></div>
                    <div id="contentnow" style="margin-top: 30px">
                        <table  width="60%" border="0" cellpadding="5" cellspacing="1">
                            <tbody>
                            <tr>
                                <td align="right" bgcolor="#ffffff" class="label label_gray "><span class="need"></span>头像:</td>
                                <td align="left" bgcolor="#ffffff">
                                    <div>
                                        <img id="head_img" src="{$user.head_img}" width="100" height="100">
                                    </div>
                                    <div>
                                        <button type="button" class="layui-btn" id="upload">
                                            上传头像
                                        </button>
                                    </div>
                                    <input id="head" type="hidden" value="{$user.head_img}">
                                </td>
                            </tr>
                            <tr>
                                <td align="right" bgcolor="#ffffff" class="label label_gray "><span class="need"></span>昵称:</td>
                                <td align="left" bgcolor="#ffffff">
                                    <input id="nickname" type="text" value="{$user.nickname}" size="25" class="intxt inputhover">
                                </td>
                            </tr>
                            <tr>
                                <td align="right" bgcolor="#ffffff" class="label label_gray "><span class="need"></span>密码:</td>
                                <td align="left" bgcolor="#ffffff">
                                    <input id="password" type="password" placeholder="留空即不修改密码" size="25" class="intxt inputhover">
                                </td>
                            </tr>
                            <tr>
                                <td align="right" bgcolor="#ffffff" class="label label_gray ">性别:</td>
                                <td align="left" bgcolor="#ffffff">
                                    <input name='sex' type="radio" onclick="set_sex(0)" value="0" {if condition="$user.sex eq 0"} checked="checked" {/if}>
                                    男&nbsp;&nbsp;
                                    <input name='sex' type="radio" onclick="set_sex(1)" value="1" {if condition="$user.sex eq 1"} checked="checked" {/if}>
                                    女&nbsp;&nbsp;
                                </td>
                            </tr>
                            <tr>
                                <td align="right" bgcolor="#ffffff" class="label label_gray ">email:</td>
                                <td align="left" bgcolor="#ffffff">
                                    <input id="email" type="text" value="{$user.email}" size="25" class="intxt inputhover">
                                </td>
                            </tr>
                            <tr>
                                <td align="right" bgcolor="#ffffff" class="label label_gray ">真实姓名:</td>
                                <td align="left" bgcolor="#ffffff">
                                    <input id="truename" type="text" value="{$user.truename}" size="25" class="intxt inputhover">
                                </td>
                            </tr>
                            <tr>
                                <td align="right" bgcolor="#ffffff" class="label label_gray ">手机号码:</td>
                                <td align="left" bgcolor="#ffffff">
                                    <input id="mobile" type="text" value="{$user.mobile}" size="25" class="intxt inputhover">
                                </td>
                            </tr>
                            <tr>
                                <td align="right" bgcolor="#ffffff" class="label label_gray ">会员积分:</td>
                                <td align="left" bgcolor="#ffffff">
                                    <input id="score" readonly type="text" value="{$user.integral}" size="25" class="intxt inputhover">
                                </td>
                            </tr>
                            <tr>
                                <td align="right" bgcolor="#ffffff" class="label label_gray ">余额:</td>
                                <td align="left" bgcolor="#ffffff">
                                    <input id="money" readonly type="text" value="{$user.money}" size="25" class="intxt inputhover">
                                </td>
                            </tr>
                            <tr>
                                <td align="right" bgcolor="#ffffff" class="label label_gray ">生日:</td>
                                <td align="left" bgcolor="#ffffff">
                                    <input id="brithday"  type="text" value="{$user.brithday}"  class="intxt inputhover">
                                </td>
                            </tr>
                            </tbody>
                        </table>
                        <p class="action">
                            <input id="btn" type="button" value="确认修改" class="btns btn-bg-org btn-s3 mr10">
                        </p>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<script src="/static/admin/js/jquery.min.js?v=2.1.4"></script>
<script src="/static/admin/js/layer/layer.js"></script>
<script src="__JS__/laydate.js"></script>
<script src="/static/home/layui/layui.js"></script>
<script>
    laydate.render({
        elem: '#brithday' //指定元素
    });
    layui.use('upload', function(){
        var upload = layui.upload;

        //执行实例
        var uploadInst = upload.render({
            elem: '#upload' //绑定元素
            ,url: '{:url('member/head_upload')}' //上传接口
            ,done: function(res){
                $('#head').val(res.path);
                $('#head_img').attr('src',res.path);
            }
        });
    });
    var sex = -1;
    function set_sex(value) {
        sex = value;
    }
    $('#btn').click(function () {
        var nickname = $('#nickname').val();
        if (nickname == '') {
            layer.msg('昵称不能为空', {icon: 5});
            return false;
        }
        var obj = new Object();
        obj['nickname'] = nickname;
        if($('#mobile').val() != ''){
            obj['mobile'] = $('#mobile').val();
        }
        if($('#truename').val() != ''){
            obj['truename'] = $('#truename').val();
        }
        if($('#email').val() != ''){
            obj['email'] = $('#email').val();
        }
        if($('#head').val() != ''){
            obj['head_img'] = $('#head').val();
        }
        if($('#password').val() != ''){
            obj['password'] = $('#password').val();
        }
        if(sex != -1){
            obj['sex'] = sex;
        }
        obj['brithday'] = $('#brithday').val();
        $.ajax({
            url: "{:url('member/update')}",
            type: 'post',
            dataType: 'json',
            data: obj,
            success: function (res) {
                alert(res.msg);
            }
        });
    });

</script>

</body>
<script>
    //JavaScript代码区域
</script>
{include file="public/footer" /}
{include file="public/foot" /}

</html>













